﻿using System;
using System.Linq;
using System.Collections.Generic;

using SharedGenomics.Core;
using SharedGenomics.DataTransfer;
using SharedGenomics.Workbench.Core;
using SharedGenomics.Annotations;

namespace SharedGenomics.Workbench.Services
{
    public class WCFAnnotationService : WCFClientHost, IAnnotationService
    {
        public Maybe<NcbiInfo[]> GetNcbiInfos(System.Collections.Generic.IEnumerable<string> markerNames)
        {
            string[] namesArray = (markerNames ?? Enumerable.Empty<string>()).ToArray();
            return this.ExecuteProxyContract<AnnotationService.IAnnotationService, SharedGenomics.DataTransfer.NcbiInfo[]>(s => s.GetDataForSnps(namesArray)).Just();
        }

        public Maybe<SharedGenomics.Workbench.AnnotationService.TavernaRequestData> GetTavernaDataFor(IEnumerable<int> entrezGeneIds)
        {
            int[] geneIdArray = (entrezGeneIds ?? Enumerable.Empty<int>()).ToArray();
            return this.ExecuteProxyContract<AnnotationService.IAnnotationService, AnnotationService.TavernaRequestData>(s => s.MakeTavernaRequests(geneIdArray)).Just();
        }
    }
}
